import java.util.List;

public class Main {

    public static void main(String[] args) {
        //添加图书
        System.out.println("-----------------------添加图书------------------------------------");
        Book book1=new Book(1,"《伟大的历史》","刘卿",false);
        Book book2=new Book(2,"《飘》","张红",false);
        Book book3=new Book(3,"《这片土地》","吴京",false);

        Library library=new Library();
        library.addBook(book1);
        library.addBook(book2);
        library.addBook(book3);

       List<Book> booklist=library.getBooklist();
       for(Book book:booklist){
           System.out.println(book.getTitle()+"  "+book.getBookid()+"  "+book.getAuthor()+" "+book.getIsBorrowed());
       }

        //借阅图书
        System.out.println("-----------------------借阅图书------------------------------------");
        book1.borrow();//第一本书被借阅了
        book2.borrow();//第二本书被借阅了
        List<Book> booklist2=library.getBooklist();
        for(Book book:booklist2){
            System.out.println(book.getTitle()+"  "+book.getBookid()+"  "+book.getAuthor()+" "+book.getIsBorrowed());
        }





        //归还图书
        System.out.println("-----------------------归还图书------------------------------------");
        book2.returnBook();//第二本书被还了

        List<Book> booklist3=library.getBooklist();
        for(Book book:booklist2){
            System.out.println(book.getTitle()+"  "+book.getBookid()+"  "+book.getAuthor()+" "+book.getIsBorrowed());
        }


        //查询图书
        System.out.println("-----------------------查询图书-----------------------------------");
        List<Book> list= library.findBookByTitle("伟大的历史");
        for(Book book:list){
            System.out.println(book.getTitle()+"借阅状态为 "+book.getIsBorrowed());
        }


        //显示所有图书状态
        System.out.println("-----------------------显示所有图书状态-----------------------------------");
        library.showBookStatus();

    }
}
